package service;

import java.util.*;

import beans.*;
import db.*;

public class mzService {
	
	public List<mzBean> browse(){
		mzDAO dao =new mzDAO();
		return dao.getAllRecords();
	}
	
	public boolean addmz(mzBean mz)
	{
		mzDAO mzDao=new mzDAO();
		return mzDao.insertRecord(mz);
	}
	
	public mzBean getRecord(String mzId)
	{
		mzDAO mzDao=new mzDAO();
		return mzDao.getRecord(mzId);
	}
	
	public int delmz(mzBean mz)
	{
		mzDAO mzDao=new mzDAO();
		if(mzDao.deleteRecord(mz))
			return 1;
		else
			return 2;
	}
	
	public int updatemz(mzBean beforeRecord,mzBean afterRecord)
	{
		mzDAO mzDao=new mzDAO();
		if(mzDao.updateRecord(beforeRecord,afterRecord))
			return 1;
		else
			return 2;
	}

	public List<mzBean> getmzsbyks(String id) {
		mzDAO mzDao=new mzDAO();
		return mzDao.getmzs(id);
	}
}
